package com.hfjyz.payment.bean;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class ConfigBean {
    private static String secPathCrt = null;
    private static String secPathKey = null;
    private static String secPathPfx = null;
    private static String searchBankURL = null;
    private static String searchKeyPass = null;

    private static String driverName = null;
    private static String jdbcUrl = null;
    private static String userName = null;
    private static String password = null;
    
    private static String shopCode = null;
    private static String shopAcct = null;

    static {
        init();
    }

    private static void init() {
        InputStream in = null;
        try {
            in = ConfigBean.class.getResourceAsStream("/config.properties");
            Properties p = new Properties();
            p.load(in);
            
            secPathCrt = p.getProperty("icbc.sec.path.crt");
            secPathKey = p.getProperty("icbc.sec.path.key");
            secPathPfx = p.getProperty("icbc.sec.path.pfx");
            searchBankURL = p.getProperty("icbc.search.bankURL");
            searchKeyPass = p.getProperty("icbc.search.keyPass");

            driverName = p.getProperty("driver.name");
            jdbcUrl = p.getProperty("jdbc.url");
            userName = p.getProperty("user.name");
            password = p.getProperty("user.password");
            
            shopCode = p.getProperty("shop.code");
            shopAcct = p.getProperty("shop.acct");
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (in != null)
                    in.close();
            } catch (IOException e) {
            }
        }
    }

    public static String getSecPathCrt() {
        return secPathCrt;
    }

    public static void setSecPathCrt(String secPathCrt) {
        ConfigBean.secPathCrt = secPathCrt;
    }

    public static String getSecPathKey() {
        return secPathKey;
    }

    public static void setSecPathKey(String secPathKey) {
        ConfigBean.secPathKey = secPathKey;
    }

    public static String getSecPathPfx() {
        return secPathPfx;
    }

    public static void setSecPathPfx(String secPathPfx) {
        ConfigBean.secPathPfx = secPathPfx;
    }

    public static String getSearchKeyPass() {
        return searchKeyPass;
    }

    public static void setSearchKeyPass(String searchKeyPass) {
        ConfigBean.searchKeyPass = searchKeyPass;
    }

    public static String getSearchBankURL() {
        return searchBankURL;
    }

    public static void setSearchBankURL(String searchBankURL) {
        ConfigBean.searchBankURL = searchBankURL;
    }

    public static String getDriverName() {
        return driverName;
    }

    public static void setDriverName(String driverName) {
        ConfigBean.driverName = driverName;
    }

    public static String getJdbcUrl() {
        return jdbcUrl;
    }

    public static void setJdbcUrl(String jdbcUrl) {
        ConfigBean.jdbcUrl = jdbcUrl;
    }

    public static String getUserName() {
        return userName;
    }

    public static void setUserName(String userName) {
        ConfigBean.userName = userName;
    }

    public static String getPassword() {
        return password;
    }

    public static void setPassword(String password) {
        ConfigBean.password = password;
    }

    public static String getShopCode() {
        return shopCode;
    }

    public static void setShopCode(String shopCode) {
        ConfigBean.shopCode = shopCode;
    }

    public static String getShopAcct() {
        return shopAcct;
    }

    public static void setShopAcct(String shopAcct) {
        ConfigBean.shopAcct = shopAcct;
    }
}
